const Base = require('./base/base');

const
	dict = "abcdefghijklmnopqrstuvwxyz";

/**
 * @extends base
 */
module.exports = class extends Base {
	encode(text,_dict){
		return text.split('').map(c=>{
			let i=_dict.indexOf(c);
			if (i==-1)
				return c;
			else
				return (i<_dict.length/2)?_dict[i+_dict.length/2]:_dict[i-_dict.length/2]
		}).join('');
	}
	encodeAction(param){
		return this.encode(this.encode(param.text,dict),dict.toUpperCase());
	}
	decodeAction(param){
		return this.encodeAction(param);
	}
}
